/**
 * Copyright (C), 2018-2018, https://blog.fundodoo.com
 * Author:   醉探索戈壁
 * Date:     2018/8/29 下午6:54
 * Description: 冒泡排序
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 * https://blog.fundodoo.com/2018/08/29/573.html
 */
package blog.fundodoo.com.algorithm;

/**
 *
 * @author 醉探索戈壁
 * @create 2018/8/29 下午6:54
 * @since 1.0.0
 */
public class BubbleSort {

    public static void bubbleSort(int[] list){
        int temp = 0;
        int length = list.length;
        for(int i= 0;i<length;i++){
            for(int j = 0;j<length-1-i;j++){
                if(list[j]>list[j+1]){
                    temp = list[j];
                    list[j] = list[j+1];
                    list[j+1] = temp;
                }
            }
        }
    }
}
